5. Citations and Bibliographies
In today's installment we discuss how to add a bibliography file to , and how to use the \cite{}
command.
There are essentially two main ways to deal with citations in . One can either:
- List all the references at the end of the document.
- Create a separate bibliography file (which you then use for all your documents).
The former becomes less efficient as soon as have written more than one document in (since it requires you to duplicate your references). As you all will surely end up writing (at least) 2 documents (eg. your BSc thesis and your MSc thesis), in these notes we will solely focus on the second option: creating a bibliography file.
Caveat Emptor
Before we get started, a little warning. There are two competing packages that allow you to work with bibliographies in , and they have similar names:
bibtex
.biblatex
.
Of the two, bibtex
is the older
biblatex
is a modernThus we will exclusively focus on the biblatex
package
bibtex
(for instance, because you have collaborators who stubbornly refuse to switchRemarks:
- A potential disadvantage of
biblatex
overbibtex
is that some journals refuse to accept submissions compiled withbiblatex
. This is unlikely to be an issue for most of youbiblatex
these days. - If you already have a
.bib
file (more on this below) that you use withbibtex
, then it only requires minimal effort to convert it to thebiblatex
format. For instance, the reference manager JabRef has a “Cleanup Entries” tool, which can perform the conversion for you. See the documentation here.
Anatomy of a Bibliography
Bibliographies in
work somewhat differently to anything we have discussed so far. The
bibliography itself is a separate file, which is saved with a .bib
extension (rather than a .tex
extension). The advantage of this is that the same bibliography file
can be reused in multiple documents. In fact, I encourage you to have a
single “master” bibliography file that you use in all your files
Not every reference listed in the bibliography file gets printed in the file. Roughly speaking, it works like this:
- Suppose your “master”
.bib
file contains 100 different references. - Your BSc thesis might only use 15 of these references. To quote a reference, you use the
\cite{name-of-reference}
command inside your file. - At the end of your file, you use the
\printbibliography
command. This instructs to search through the master.bib
file and pick out all the references that were actually used in the current document (via the\cite{}
command), and then print them in a list.
Older than me! ↩︎
Well, nothing about LaTeX is truly “modern”... So perhaps “less ancient” would be more accurate. ↩︎
Pro tip: The easy way to remember which one is better: LaTeX ≥ TeX, and thus also
biblatex
≥bibtex
. ↩︎Yes, R*****n, I am talking to you! ↩︎
Because, let's face it, you are unlikely to publish your Bachelors thesis in a journal. ↩︎
You can even share a single
.bib
file with your friends! ↩︎
Getting Started
Let's
see how this works in practice. If you are using Overleaf, to add a
bibliography file you simply create a new file inside the project tree
with a .bib
extension. Alternatively, if you already have a
bibliography file, then you upload it to your project. It should look
something like this:

If you are using on your computer, then it is a bit more complicated. You need to tell your editor to use the biber
backend. If for instance you are using the TeXShop, go to Preferences > Engine
and change the default BibTeX engine to biber
. For other editors, see this post for detailed instructions.
Here is a very simple of a .bib
file, with precisely one entry:
And here is a file that uses this bibliographic information.

The salient points are:
- We invoked the
biblatex
package via the now familiar\usepackage{biblatex}
command in the preamble. - We then told to load the file
sample.bib
. This file should be in the same directory as the.tex
file—if you are using Overleaf then it should be as pictured above. - To cite an entry from the bibliography, we use the command
\cite{internal-name}
, whereinternal-name
is the “internal name” for that particular entry (more on this shortly). - Just before the
\end{document}
line, we added the\printbibliography
command.
Now let us turn back to the file sample.bib
again:
- The first line begins with
@book
. This tells that this entry is a book. If instead we were referencing a journal article, we would use@article
instead. A table of all the common options is below. - The rest of the entry is wrapped in a pair of braces
{ ... }
. - The next line of text contains the “internal name” for this reference. The comma at the end is important!
.bib
file ends up with hundreds of entries. The internal name must be unique.
The next five lines contain the actual bibliographic information. The syntax is mostly self-explanatory. The important points to remember are:
- You must use an
=
key to separate the property name (eg.author
) from the value the property should take (eg.{J. K. Rowling}
). - You must wrap the property value inside a pair of braces: thus it is
{J. K. Rowling}
, and notJ. K. Rowling
. - You must end each line with a comma.
- If there are multiple authors, you must separate each one with the word
and
.
Other than that, the order of the properties and the spacing is completely irrelevant. As far as is concerned, the following file is identical to the previous one:
You can even put everything on one line if you want:
Therefore the only reason to line things up neatly is so that they are easier to read. If you use a reference manager (more on this shortly) then it will typically do this automatically for you.
In our example we had five properties: title
, author
, date
, publisher
, isbn
. Of these the first three are required properties, and the last two are optional.
The date
field is usually just the year. If you want to be more precise, use the YYYY-MM-DD
format.
As mentioned above, if there are multiple authors you must always use the word and
to separate them. How the authors are actually printed depends on the
bibliography style chosen—for example, if an article has four or more
authors, some styles will print only the name of the first author, and
then “et. al.”
Moreover depending on which bibliography
style you choose, some properties may not get printed at all. For
example, another property you can use is keywords
. Most bibliography styles (including the default one we used above) will not print these out.
Here is a table summarising the standard reference types, and some of the common properties that go with them:
Reference type | What it's used for | Required properties | Common optional properties |
---|---|---|---|
article | An article in a journal. | author, title, journaltitle, date | volume, number, pages, doi |
book | A book. | author, title, date | series, publisher, volume, isbn, edition |
thesis | A thesis. | author, title, type, institution, date | url |
online | An online resource. | author/editor, title, date, url | urldate |
collection | A book with multiple contributions by different people. Has an editor. | editor, title, date | series, publisher, volume, isbn, edition |
incollection | A single chapter in a collection. | author, title, booktitle, date | series, publisher, volume, isbn, edition |
proceedings | Proceedings from a conference. | title, date | eventtitle, editor, location/venue |
inproceedings | A single paper in a conference proceedings. | author, title, booktitle, date | eventtitle, editor, location/venue |
unpublished | Something that has not been published. | author, title, date | url |
This is not remotely an exhaustive list, and we refer you to the official documentation for more details (see §2.2.1).
Reference Manager Software
Curating a large .bib
file takes a long time. The (free) reference manager JabRef is quite good, and supports biblatex
. There are other options too, such as BibDesk (which is macOS only). That said, I personally prefer to work with the .bib
file directly, using some helpful shortcuts and scripts to speed up the
process. I'll discuss my approach further in the last of these tutorials.
Here is a slightly more interesting sample bibliography file—called sample2.bib
—with four entries, which we will use in our examples for the rest of the lecture.
Here is an example of a file that uses this bibliography file:

Note we only used two of the four entries of sample2.bib
.
Customising Your Bibliography
Let
us now look at ways to customise the appearance of the printed
bibliography file. The important point to understand is that these
changes are all done in the file, and not in the .bib
file. This is why you can use the same .bib
file for multiple documents.

We made two changes here:
- We added the option
style=alphabetic
when calling the packagebiblatex
. Remember that the general syntax is\usepackage[options]{name}
. This changed the appearance of the references from the default numbers [1], [2], etc, to include the first three letters of the author's surname, and the year. - We changed the default name References to Sources by adding the option
title=Sources
to the\printbibliography
command at the end.
There are many different styles you can choose (see §3.3.2 of the official documentation), but I recommend you stick to either the default one (which is also called numeric
) or the alphabetic
one displayed above, since these are the most commonly used in mathematics.
You
can also customise the order that the bibliography entries appear in.
By default, the entries are sorted by name, then title, then year. If
instead you wanted them to be sorted first by year, then name, then
title, add the option [sorting=ynt]
.

Note how this time [Wil95] appeared before [Row97] in the References section.
Some common options for sorting include:
Sorting option | What it does |
---|---|
nyt |
Sorts by name, year, then title. (This is the default.) |
ynt |
Sorts by year, name, then title. |
ydnt |
Sorts by year (depending), name, then title. |
nyvt |
Sorts by name, year, volume then title. |
none |
No sorting. Entries appear in the order they are referenced. |
A full list can be found in Appendix C of the official documentation.
Often you want to explicitly reference a particular section of a given paper. This is done by modifying the \cite{}
command by inserting a pair of square brackets like so: \cite[Theorem 1]{reference-name}
.

Finally,
it is sometimes nice to split up the bibliography into multiple
sections. For example, you might want to list all the published papers
in one section, and all the preprints in another. This is easily done by
modifying the \printbibliography
command.
Consider the following snippet.
The first line \printbibheading
tells to print out References like usual. The next line tells to create a sub-bibliography with the title Name-1, and then print out all the references that satisfy the conditions specified by options-1
. The third line does this again for a second sub-bibliography.
This is easiest to understand with an example:

Here the first sub-bibliography selected all references that were not online sources using the syntax nottype=online
and the second sub-bibliography selected those references which were
online sources. Again, many more options are available to you—see the
official documentation for more details.
Alternatively,
perhaps you'd like to have one bibliography at the end of each section.
This can be achieved by adding the option refsection=section
, as the following example demonstrates.

That's it for today!